<!--查看应聘者，米娜事，考核，录用-->
<template>
  <div id="cornerComment" v-if="dialogVisible">
    <div class="cornerComment-in" ref="dialogBox">
      <div class="cornerComment-in-title">
        <!--        resumeType 1 查看简历 2 待处理的简历 3 待面试简历 4 考核中的应聘者 5 一录用应聘者-->
        <span>{{ resumeName }}-预约面试</span>
        <span class="el-icon-circle-close close-Btn-line" @click="closePOpup"></span>
      </div>
      <div class="commentBody">
        <el-form label-width="90px" ref="editForm">
          <el-row>
            <el-col :span="24">
              <el-form-item label="面试时间：" prop="name">
                <el-date-picker
                    v-model="value1"
                    value-format="yyyy-MM-dd"
                    type="date"
                    :picker-options="pickerOptions1"
                    placeholder="选择日期">
                </el-date-picker>
                <el-time-select
                    v-model="value"
                    :picker-options="{
    start: '08:30',
    step: '00:15',
    end: '18:30'
  }"
                    placeholder="选择时间">
                </el-time-select>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </div>
      <div class="cornerComment-in-footer">
        <el-button @click="closePOpup" size="small">返回</el-button>
        <el-button type="primary" @click="getTime()" size="small">确认并保存</el-button>
      </div>
    </div>
  </div>
</template>

<script>

export default {
  props: ['visible', 'resumeId', 'resumeName'], // commoent 学生点评 collection 学生采集
  data() {
    return {
      dialogVisible: false,
      value1: '',
      value: '',
      pickerOptions1:
          {
            disabledDate(time) {
              return time.getTime() < Date.now() // - 8.64e7
            }
          },
    }
  },
  watch: {
    visible() {
      this.dialogVisible = this.visible
    }
  },
  created() {
  },
  methods: {
    // 关闭弹窗
    closePOpup() {
      this.$emit('update:visible', false)
    },
    getTime() {
      let n = this;
      if (!this.value1 || !this.value) {
        this.$message.error('请完善预约时间')
        return
      }
      this.$confirm(`确认预约面试时间${this.value1} ${this.value}, 是否继续?`, '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        n.saveApplyFn()
      }).catch(() => {

      });
    },
    async saveApplyFn() {
      let data = await this.$post(this.api.recruit.vitae.adopt, {
        id: this.resumeId,
        time: `${this.value1} ${this.value}`
      });
      console.log('简历详情:', data)
      if (!data.code) {
        this.value1 = '';
        this.value = '';
        this.$emit('getResumeDetail','appointment');
        this.closePOpup();
      } else {
        this.$message.error(data.msg)
      }
    }
  },
  mounted() {
  }
}
</script>
<style scoped>
#cornerComment {
  height: 100vh;
  width: 100%;
  position: fixed;
  top: 0;
  left: 0;
  background: rgba(0, 0, 0, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9;
}

.cornerComment-in {
  width: 40%;
  height: 30%;
  background: #fff;
  display: flex;
  flex-direction: column;
  border-radius: 5px;
}

.cornerComment-in-title {
  height: 50px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #ddd;
  font-size: 24px;
}

.cornerComment-in-title span {
  padding: 0 10px;
}

.cornerComment-in-title span:first-child {
  flex: 1;
  font-size: 16px;
}

.cornerComment-in-footer {
  height: 50px;
  border-top: 1px solid #ddd;
  display: flex;
  align-items: center;
  padding: 0 10px;
  justify-content: center;
}

.commentBody {
  padding: 20px 10px;
  flex: 1;
  overflow-y: auto;
}

.close-Btn-line {
  cursor: pointer;
}

</style>

